﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FingerVein_Database_Collection
{
    public partial class Settings_Form : Form
    {
        float saturation, gamma;

        public Settings_Form()
        {
            InitializeComponent();
        }

        private void Settings_Form_Load(object sender, EventArgs e)
        {
            txtBrightness.Text = tbBrightness.Value.ToString();
            txtContrast.Text = tbContrast.Value.ToString();
            txtSaturation.Text = ((float)(tbSaturation.Value / 1000f)).ToString("R");
            txtSharpness.Text = tbSharpness.Value.ToString();
            txtGamma.Text = ((float)(tbGamma.Value / 10f)).ToString("R") ;
            
        }

        private void tbBrightness_Scroll(object sender, EventArgs e)
        {
            txtBrightness.Text = tbBrightness.Value.ToString();
            MainForm.brightnessFilter.AdjustValue = Convert.ToInt32(txtBrightness.Text);

        }

        private void tbContrast_Scroll(object sender, EventArgs e)
        {
            txtContrast.Text = tbContrast.Value.ToString();
            MainForm.contrastFilter.Factor = Convert.ToInt32(txtContrast.Text);
            
        }

        private void tbSaturation_Scroll(object sender, EventArgs e)
        {
            saturation = (float)(tbSaturation.Value / 1000f);

            txtSaturation.Text = saturation.ToString("R");
            MainForm.saturationFilter.AdjustValue = saturation;
        }

        private void tbSharpness_Scroll(object sender, EventArgs e)
        {
            txtSharpness.Text = tbSharpness.Value.ToString();
            MainForm.gausiapSharpenfilter.Sigma = tbSharpness.Value;
        }

        private void tbGamma_Scroll(object sender, EventArgs e)
        {
            gamma = (float)(tbGamma.Value / 10f);
            txtGamma.Text = gamma.ToString("R");

            MainForm.gammaFilter.Gamma = gamma;
        }
    }
}
